<template>
  <div>
    <button v-if="flag" @click="subBtn">点击搜索</button>
    <input ref="input" type="text" v-else />
  </div>
</template>

<script>


export default {


  data() {
    return {
      flag: true,
    }
  },
  methods: {
    subBtn() {
      this.flag =false
      this.$nextTick(()=>{
        this.$refs.input.focus()
      })
    },
  },
}
</script>

<style></style>
